import request from '@/utils/request'

// 查询基础数据列表
export function listDatabase(query) {
  return request({
    url: '/reportworld/database/list',
    method: 'get',
    params: query
  })
}

// 初始化查询
export function init(data) {
  return request({
    url: '/reportworld/database/init',
    method: 'post',
    data: data
  })
}

// 查询基础数据详细
export function getDatabase(data) {
  return request({
    url: '/reportworld/database/getDatabase',
    method: 'post',
    data: data
  })
}

// 查询基础数据详细
export function getDatabaseByCode(code, hisVersion) {
  const data = {
    code,
    hisVersion
  };
  return request({
    url: '/reportworld/database/getDatabaseByCode',
    method: 'post',
    data: data
  })
}

// 新增基础数据
export function addDatabase(data) {
  return request({
    url: '/reportworld/database',
    method: 'post',
    data: data
  })
}

// 修改基础数据
export function updateDatabase(data) {
  return request({
    url: '/reportworld/database',
    method: 'put',
    data: data
  })
}

// 删除基础数据
export function delDatabase(id, hisVersion) {
  const data = {
    id,
    hisVersion
  };
  return request({
    url: '/reportworld/database/remove',
    method: 'post',
    data: data
  })
}

// 构建基础数据信息
export function structureDataBase(code, hisVersion) {
  const data = {
    code,
    hisVersion
  };
  return request({
    url: '/reportworld/database/structureDataBase/',
    method: 'post',
    data: data
  })
}


//查询基础数据列表信息
export function getDataBaseInfo(queryJson) {
  return request({
    url: '/reportworld/database/getDataBaseInfo',
    method: 'post',
    data: queryJson
  })
}

//新增基础数据列表信息
export function addDataBaseInfo(addJson) {
  return request({
    url: '/reportworld/database/addDataBaseInfo',
    method: 'post',
    data: addJson
  })
}

//修改基础数据列表信息
export function updateDataBaseInfo(updateJson) {
  return request({
    url: '/reportworld/database/updateDataBaseInfo',
    method: 'post',
    data: updateJson
  })
}

// 删除基础数据
export function removeDataBaseInfo(deleteJson) {
  return request({
    url: '/reportworld/database/removeDataBaseInfo',
    method: 'post',
    data: deleteJson
  })
}

//修改基础数据列表信息
export function handleUpdateBatch(updateJson) {
  return request({
    url: '/reportworld/database/handleUpdateBatch',
    method: 'post',
    data: updateJson
  })
}


//导出基础数据SQL
export function dataBaseSql(queryJson) {
  return request({
    url: '/reportworld/database/dataBaseSql',
    method: 'post',
    data: queryJson
  })
}

// 获取一个表的策略文件
export function getCompareconfig(code) {
  return request({
    url: '/reportworld/database/getCompareconfig/' + code,
    method: 'get'
  })
}

// 修改一个表的策略信息
export function updateCompareconfig(updateJson) {
  return request({
    url: '/reportworld/database/updateCompareconfig',
    method: 'post',
    data: updateJson
  })
}


